<template>
    <Layout>

        <el-tabs type="border-card">
            <el-tab-pane label="项目计划汇总表">
                <el-card>
                    <!-- <div>
        <UploadExcel :onSuccess="success" :isShow="isShow" @getShow="getShow"></UploadExcel>
      </div> --><span class="span">项目计划汇总表</span>
                    <el-table :data="list" border style="width: 100%" v-loading="loading" element-loading-text="拼命加载中"
                        element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
                        <el-table-column prop="id" label="序号" width="150">
                        </el-table-column>
                        <el-table-column prop="projectNumber" label="立项编号" width="180">
                        </el-table-column>
                        <el-table-column prop="standardName" label="标准名称" width="300">
                        </el-table-column>
                        <el-table-column prop="standardNature" label="标准性质" width="180">
                        </el-table-column>
                        <el-table-column prop="formulate" label="制定或修订" width="180">
                        </el-table-column>
                        <el-table-column prop="addTime" label="起止年限" width="180">
                        </el-table-column>
                        <el-table-column prop="advancedStandards" label="采用国际标准或国外先进标准" width="180">
                        </el-table-column>
                        <el-table-column prop="groupProposing" label="团体标准提出单位" width="180">
                        </el-table-column>
                        <el-table-column prop="draftingUnit" label="主要负责起草单位" width="180">
                        </el-table-column>
                        <el-table-column prop="remark" label="备注" width="180">
                        </el-table-column>
                        <el-table-column fixed="right" label="操作" width="150">
                            <template slot-scope="scope">
                                <el-button size="small" type="primary" @click="select(scope.row)" icon="el-icon-edit"
                                    circle></el-button>
                                <el-button size="small" type="success" @click="update(scope.row)" icon="el-icon-check"
                                    circle></el-button>
                                <el-button size="small" type="danger" @click="deleted(scope.row)" icon="el-icon-delete"
                                    circle></el-button>
                            </template>
                        </el-table-column>
                    </el-table>


                    <div class="block">
                        <el-pagination background layout="prev, pager, next" :page-count="pager.pages"
                            :current-page.sync="pager.page" @current-change="currentChange" :page-size.sync="pager.limit">
                        </el-pagination>
                    </div>
                </el-card></el-tab-pane>
            <el-tab-pane label="发布汇总表">
                <el-card>
                    <span
                        class="span">发布汇总表</span><!-- <div><UploadExcel :onSuccess="success" :isShow="isShow" @getShow="getShow"></UploadExcel></div> -->
                    <el-table :data="lists" border style="width: 100%" v-loading="loading" element-loading-text="拼命加载中"
                        element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
                        <el-table-column prop="id" label="序号" width="150">
                        </el-table-column>
                        <el-table-column prop="projectNumber" label="标准类型" width="180">
                        </el-table-column>
                        <el-table-column prop="standardCode" label="标准代号" width="300">
                        </el-table-column>
                        <el-table-column prop="standardName" label="标准名称" width="180">
                        </el-table-column>
                        <el-table-column prop="releaseDate" label="发布日期" width="180">
                        </el-table-column>
                        <el-table-column prop="updateTime" label="实施日期" width="180">
                        </el-table-column>
                        <el-table-column prop="proposedUnit" label="起草单位" width="180">
                        </el-table-column>
                        <el-table-column prop="groupProposing" label="" width="180">
                        </el-table-column>
                        <el-table-column prop="draftingUnit" label="主要负责起草单位" width="180">
                        </el-table-column>
                        <el-table-column fixed="right" label="操作" width="150">
                            <template slot-scope="scope">
                                <el-button size="small" type="primary" @click="selectss(scope.row)" icon="el-icon-edit"
                                    circle></el-button>
                                <el-button size="small" type="success" @click="updatess(scope.row)" icon="el-icon-check"
                                    circle></el-button>
                                <el-button size="small" type="danger" @click="deletedss(scope.row)" icon="el-icon-delete"
                                    circle></el-button>
                            </template>
                        </el-table-column>
                    </el-table>


                    <div class="block">
                        <el-pagination background layout="prev, pager, next" :page-count="pagers.pages"
                            :current-page.sync="pagers.page" @current-change="currentChanges">
                        </el-pagination>
                    </div>
                </el-card>
            </el-tab-pane>
            <el-tab-pane label="立项汇总表">
                <el-card>
                    <span
                        class="span">立项汇总表</span><!-- <div><UploadExcel :onSuccess="success" :isShow="isShow" @getShow="getShow"></UploadExcel></div> -->
                    <el-table :data="listss" border style="width: 100%" v-loading="loading" element-loading-text="拼命加载中"
                        element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
                        <el-table-column prop="standardType" label="标准类型" width="180">
                        </el-table-column>
                        <el-table-column prop="projectNumber" label="立项编号" width="300">
                        </el-table-column>
                        <el-table-column prop="standardName" label="标准项目名称" width="180">
                        </el-table-column>
                        <el-table-column prop="standardNature" label="标准性质" width="180">
                        </el-table-column>
                        <el-table-column prop="formulate" label="制定或修订" width="180">
                        </el-table-column>
                        <el-table-column prop="addTime" label="起止年限" width="180">
                        </el-table-column>
                        <el-table-column prop="advancedStandards" label="采用国际标准或国外先进标准" width="180">
                        </el-table-column>
                        <el-table-column prop="standardProposing" label="地方标准提出单位" width="180">
                        </el-table-column>
                        <el-table-column prop="draftingUnit" label="主要负责起草单位" width="180">
                        </el-table-column>
                        <el-table-column fixed="right" label="操作" width="150">
                            <template slot-scope="scope">
                                <el-button size="small" type="primary" @click="selectsss(scope.row)" icon="el-icon-edit"
                                    circle></el-button>
                                <el-button size="small" type="success" @click="updatesss(scope.row)" icon="el-icon-check"
                                    circle></el-button>
                                <el-button size="small" type="danger" @click="deletedsss(scope.row)" icon="el-icon-delete"
                                    circle></el-button>
                            </template>
                        </el-table-column>
                    </el-table>


                    <div class="block">
                        <el-pagination background layout="prev, pager, next" :page-count="pagerss.pages"
                            :current-page.sync="pagerss.page" @current-change="currentChangesss">
                        </el-pagination>
                    </div>
                </el-card>
            </el-tab-pane>
            <!-- <el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane> -->
        </el-tabs>

    </Layout>
</template>
<script>
import Layout from "@/components/Layout.vue"
import axios from "axios";
export default {
    data() {
        return {
            loading: false,
            listss: [],
            pagerss: {
                limit: 10,
                page: 1,
                pages: 1,
            },
            lists: [],
            pagers: {
                limit: 10,
                page: 1,
                pages: 1,
            },
            list: [],
            pager: {
                limit: 10,
                page: 1,
                pages: 1,
            },


        }

    },
    methods: {
        deletedsss(row) {
            this.loading = true
            axios({
                url: "http://43.143.166.235:8090/project/deleted?projectNumber=" + row.projectNumber
            }).then(res => {
                console.log(res)
            }).finally(() => {
                setTimeout(() => {
                    this.loading = false
                }, 100)
            })
        },
        updatesss() {
            this.$router.push({
                name: "project",
            })
        },
        selectsss(row) {
            this.$router.push({
                name: "project",
                params: {
                    cid: row.projectNumber
                }
            })
        },
        updatess() {
            this.$router.push({
                name: "publishCreate"
            })
        },
        selectss(row) {
            this.$router.push({
                name: "publishCreate",
                params: {
                    cid: row.id
                }
            })
        },
        deletedss(row) {
            axios({
                url: "http://43.143.166.235:8090/publish/deleted?id=" + row.id
            }).then(res => {
                alert("删除成功")
            })
        },
        publish() {
            console.log("aaaaaaaaa")
        },
        update() {
            this.$router.push({
                name: 'programCreate'
            })
        },
        select(row) {
            this.$router.push({
                name: "programdetail",
                params: {
                    cid: row.id
                }
            })
        },

        deleted(row) {
            axios({
                url: "http://43.143.166.235:8090/program/deleted?id=" + row.id
            }).then(res => {
                alert("删除成功")
            })
        },
        currentChange(page) {
            this.pager.page = page
            axios({
                url: "http://43.143.166.235:8090/program/home?page=" + this.pager.page + "&limit=" + this.pager.limit
            }).then(res => {


                this.list = res.data.data.list.list
                this.pager = {
                    page: res.data.data.page,
                    pages: res.data.data.pages,
                    limit: res.data.data.limit
                }
            })
        },
        currentChanges(page) {
            this.pagers.page = page
            axios({
                url: "http://43.143.166.235:8090/program/home?page=" + this.pagers.page + "&limit=" + this.pagers.limit
            }).then(res => {


                this.lists = res.data.data.list.list
                this.pagers = {
                    page: res.data.data.page,
                    pages: res.data.data.pages,
                    limit: res.data.data.limit
                }
            })
        },
        currentChangesss(page) {
            this.pagerss.page = page
            axios({
                url: "http://43.143.166.235:8090/project/list?page=" + this.pagerss.page + "&limit=" + this.pagerss.limit
            }).then(res => {
                this.listss = res.data.data.list.list
                this.pagerss = {
                    page: res.data.data.page,
                    pages: res.data.data.pages,
                    limit: res.data.data.limit
                }
            })
        },
    },
    created() {
        this.loading = true
        axios({
            url: "http://43.143.166.235:8090/publish/home?page=" + this.pagers.page + "&limit=" + this.pagers.limit
        }).then(res => {
            console.log(res)
            this.lists = res.data.data.list.list
            this.pagers = {
                page: res.data.data.page,
                pages: res.data.data.pages,
                limit: res.data.data.limit
            }
        }).finally(() => {
            setTimeout(() => {
                this.loading = false
            }, 100)
        })
        axios({
            url: "http://43.143.166.235:8090/program/home?page=" + this.pager.page + "&limit=" + this.pager.limit
        }).then(res => {
            console.log(res)
            this.list = res.data.data.list.list
            this.pager = {
                page: res.data.data.page,
                pages: res.data.data.pages,
                limit: res.data.data.limit
            }
        }).finally(() => {
            setTimeout(() => {
                this.loading = false
            }, 100)
        })
        axios({
            url: "http://43.143.166.235:8090/project/list?page=" + this.pagerss.page + "&limit=" + this.pagerss.limit
        }).then(res => {
            console.log(res)
            this.listss = res.data.data.list.list
            this.pagerss = {
                page: res.data.data.page,
                pages: res.data.data.pages,
                limit: res.data.data.limit
            }
        }).finally(() => {
            setTimeout(() => {
                this.loading = false
            }, 100)
        })
    },
    components: {
        Layout
    }
}
</script>

<style>
.span {

    font-size: 20px;
    line-height: 50px;
}

.el-breadcrumb {
    line-height: 20px;
}

.block {
    display: flex;
    background-color: #fff;
    justify-content: center;
    padding: 10px 0;

}

.clearfix {
    display: flex;
    justify-content: space-between;
}

.upload-demo {
    display: inline;
    margin-left: 10px;
}
</style>